package com.xjoyt.pay.master.po;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ForeignKey;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.GenericGenerator;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.xjoyt.pay.constants.DateConstant;

/**
 * 充值消费流水表
 * 
 * @author ptt
 *
 */
@Entity
@Table(name = "t_recharge")
public class Recharge {
	@Id
	@GeneratedValue(generator = "uuid")
	@GenericGenerator(name = "uuid", strategy = "uuid2")
	@Column(name = "recharge_id", length = 36)
	public String id;

	/**
	 * 商户
	 */
	@ManyToOne(targetEntity = Merchant.class, cascade = {})
	@JoinColumn(name = "merchant_id", foreignKey = @ForeignKey(name = "none"))
	public Merchant merchant;

	/**
	 * 通道
	 */
	@ManyToOne(targetEntity = Channel.class, cascade = {})
	@JoinColumn(name = "channel_id", foreignKey = @ForeignKey(name = "none"))
	public Channel channel;

	/**
	 * 金额(分)
	 */
	@Column(name = "money")
	public Long money;

	/**
	 * 充值消费 (true:充值， false：消费)
	 */
	@org.hibernate.annotations.Type(type = "yes_no")
	@Column(name = "recharge_mold")
	public Boolean rechargeMold;

	/**
	 * 充值类型 (true:手动充值， false：自动充值)
	 */
	@org.hibernate.annotations.Type(type = "yes_no")
	@Column(name = "recharge_type")
	public Boolean rechargeType;

	/**
	 * 流水号
	 */
	@Column(name = "no", length = 50)
	public String no;

	/**
	 * 日期
	 */
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "added_date")
	@JsonFormat(pattern = DateConstant.DATE_TIME_FORMAT_PATTERN, timezone = "GMT+8")
	public Date addedDate;

}
